import { GOODS_PORT } from "@/api/config/servicePort";
import http from "@/api";
import { Goods } from "@/api/interface";

export const getGoodsList = (params: Goods.ReqGoods) => {
  return http.post(GOODS_PORT + `/list`, params, { loading: false });
};

export const addGoods = (params: Goods.ReqGoods) => {
  return http.post(GOODS_PORT + `/add`, params, { loading: false });
};

export const deleteGoodsAPI = (params: number[]) => {
  return http.post(GOODS_PORT + `/delete`, params, { loading: false });
};

export const editGoods = (params: Goods.ReqGoods) => {
  return http.put(GOODS_PORT + `/edit`, params, { loading: false });
};

export const getGoodsConditions = () => {
  return http.get(GOODS_PORT + `/condition`);
};

export const exportGoods = (params: Goods.ReqGoods) => {
  return http.download(GOODS_PORT + `/export`, params);
};

export const BatchAddGoods = (params: FormData) => {
  return http.post(GOODS_PORT + `/import`, params);
};
